package top.amot.forceview.drawitem

import top.amot.forceview.model.AbstractLink
import top.amot.forceview.model.AbstractNode

class DrawManager {
    private val drawNodeMap = mutableMapOf<String,AbstractDrawItem<AbstractNode>>()
    private val drawLinkMap = mutableMapOf<String,AbstractDrawLink<AbstractLink<AbstractNode,AbstractNode>>>()

    fun <T:AbstractNode> putDrawNode(nodeType: String,nodeDrawItem: AbstractDrawItem<T>){
        drawNodeMap[nodeType] = nodeDrawItem as AbstractDrawItem<AbstractNode>
    }

    fun putDrawLink(linkType:String,linkDrawLink: AbstractDrawLink<AbstractLink<AbstractNode,AbstractNode>>){
        drawLinkMap[linkType]=linkDrawLink
    }

    fun findDrawItem(node: AbstractNode): AbstractDrawItem<AbstractNode>? {
       return drawNodeMap[node.type]
    }

    fun findDrawLink(link:AbstractLink<AbstractNode,AbstractNode>):AbstractDrawLink<AbstractLink<AbstractNode,AbstractNode>>?{
       return drawLinkMap[link.lineType]
    }


}